<?php include  APP_PATH.'../template/public/header.php'?>
<aside class="main-sidebar">
    <section class="sidebar">
        <?php include APP_PATH.'../template/public/navigation.php'?>
    </section>
</aside>
<div class="content-wrapper">
    <section class="content-header">
        <h1>
            {$title}
        </h1>

        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> {$title}</a></li>
        </ol>
    </section>
    <section class="content">
        <div class="box">
            <div class="box-body">
                <form id="form" role="form" class="col-md-8">
                    <div class="form-group">
                            <label >选择列表</label>
                            <select name="superior_id" class="form-control">
                                <option value="">顶级行业</option>
                                <?php   foreach ($industry as $v){?>
                                <option  value="{$v.id}" >{$v.name}</option>
                                <?php }?>
                            </select>
                    </div>
                    <div class="form-group">
                        <label for="name">行业名称</label>
                        <input type="text" name="name" class="form-control" id="name" placeholder="请输入名称">
                    </div>
                    <div class="form-group">
                        <button id="submit"  class="btn btn-default">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </section>
</div>
<?php include APP_PATH.'../template/public/footer.php'; ?>
<script>

    $('#submit').click(function () {
        var data = {};
        var t = $('#form').serializeArray();
        $.each(t, function () {
            data[this.name] = this.value;
        });
        console.log(data);

        var loading = layer.load(1, {shade: [0.1, '#fff']});
        $.post("{:url('')}", data, function (res) {
            layer.close(loading);
            if (res.code > 0) {
                layer.msg(res.msg, {time: 1800, icon: 1}, function () {
                    location.href = res.url;
                });
            } else {
                layer.msg(res.msg, {time: 1800, icon: 2});
            }
        });
        return false;
    });
</script>
</html>